package bojin.studio.weather.indicator;

import android.content.Context;
import android.location.Location;
import android.location.LocationManager;

public class userLocation {
	 LocationManager lm;
	 Location mostRecentLocation;
	 double latid=25.012085,longid=121.465701;
	public userLocation(Context context)
	{
		lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
	     //Criteria criteria = new Criteria();
	     //criteria.setAccuracy(Criteria.ACCURACY_FINE);
	     //criteria.setAccuracy(Criteria.ACCURACY_COARSE);
	     //String provider = lm.getBestProvider(criteria, true);
	     try{
	         mostRecentLocation = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
	     }
	     catch(Exception e)
	     {}  
	}
	
	public int getLatitude()
	{
		 if(mostRecentLocation!=null){
	      	  latid=mostRecentLocation.getLatitude()*1E6;
		 }
		 return ((int)latid)/1;
	}
	
	public int getLongitude()
	{
		if(mostRecentLocation!=null){
			longid=mostRecentLocation.getLongitude()*1E6;
		}
		return ((int)longid)/1;
	}

}
